using System;
using System.Collections.Generic;
using FPLibrary;
using UnityEngine;
using Pvp.Timeline;

namespace Pvp
{
    public class FightUnitEntity : MonoBehaviour
    {
        public GameObject unityObj;
        public FPVector transPosition;
        public string animatorStateName;
        public int skillIndex;
        public bool canSkillFalg;

        public SkillPlayDirector skillDirector;

        public UnitSkillData skillData;
    }

    /// <summary>
    /// 角色技能数据
    /// </summary>
    public class UnitSkillData : ScriptableObject
    {
        public int heroId;
        public SkillItem skill_1;
        public SkillItem skill_2;
        public SkillItem skill_3;
        public SkillItem skill_4;
        public SkillItem skill_5;

        public SkillItem GetSkill(int index)
        {
            if (index < 1 || index > 5)
                throw new Exception("get skilldata error");
            if (index == 1)
                return skill_1;
            if (index == 2)
                return skill_2;
            if (index == 3)
                return skill_3;
            if (index == 4)
                return skill_4;

            return skill_5;
        }
        
#if UNITY_EDITOR
        [UnityEditor.MenuItem("Tools/Pvp/创建角色技能")]
        static void create()
        {
            var config = ScriptableObject.CreateInstance<UnitSkillData>();
            UnityEditor.AssetDatabase.CreateAsset(config, "Assets/RuntimeResources/Skill/test.asset");
        }
#endif
        [System.Serializable]
        public class SkillItem
        {
            public int skillIndex;
            public List<UnityEngine.Playables.PlayableAsset> skillAssets;
        }
    }
}